package chapter08;

/**
 * Created by V5470-I5 on 2016/3/31.
 */
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class FileUtil2 {
    public static String readFile1(String name)throws FileNotFoundException{
        StringBuilder text=new StringBuilder();
        try (Scanner console=new Scanner(new FileInputStream(name))){
            while (console.hasNext()){
                text.append(console.nextLine())
                        .append('\n');
            }
        }
        return text.toString();
    }
}
